<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>${appname}-<c:if test="${!empty sessionScope._local_node_session}">${sessionScope._local_node_session.nodeName}-</c:if>${si:ctname("NET_TYPE",sessionScope._netType)}</title>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>
<script type="text/javascript">
$(function(){
	$('.tipMe').tooltip({'placement':'top'});
	 if('${param.status}' =='1'){
		 $('#succ').addClass("active");
	 	   	$('#fail').removeClass("active");
	 	   	$("#muenSync").hide();
	 	}else{
	 		
	 		$('#succ').removeClass("active");
			$('#fail').addClass("active");
			$("#muenSync").show();
	 	}
})
function menuSync(){
	$.ajax({
		   type: "POST",
		   dataType:"json",
		   cache: false,
		   url: _ctx + "/exch/re_sync.do",
		   success: function(resp){
			   if(resp.status == '1'){
				   ui.msg(resp.msg, 1);
				   ui.go(_ctx + '/exch/sync_info_list.do');
			   }else{
				   ui.msg(resp.msg, 0);
			   }
		   },
		   error:function(){
			   ui.msg('信息加载错误', 0);
		   }
	});
}
function search(form) {
	$(form).appendPagerParaStr();
	return true;
}


 function syncInfoList(val){
	 $('#status').val(val);
 	if(val=='0'){
		$('#succ').removeClass("active");
		$('#fail').addClass("active");
 	}else{
 		$('#succ').addClass("active");
 	   	$('#fail').removeClass("active");
 	}
 	$('#searchForm').submit();
}
</script>
</head>
<body>
	<%@ include file="/WEB-INF/view/common/topbar.jsp"%>
	<div class="main-container" id="main-container">
		<div class="main-container-inner">
			<%@ include file="/WEB-INF/view/common/sidebar.jsp"%>
			<div class="main-content">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb">
						<li><i class="icon-home home-icon"></i> <a href="#">首页</a></li>
						<li><a href="#">交换管理</a></li>
						<li><a href="#">信息同步管理</a></li>
						<li class="active">列表</li>
					</ul>
				</div>
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
							<div class="widget-box">
								<div class="widget-header header-color-white"></div>
								<div class="widget-box" >
									<div class="widget-body">
										<div class="widget-main">
											<form id="searchForm" class="form-search"
												action="${ctx}/exch/sync_info_list.do" method="post"
												onsubmit="return search(this)">
												<div class="row">
													<input type="hidden" name="status" id="status"
														value="${param.status}" />
													<div class="col-sm-4">
														<div class="input-group">
															<span class="input-group-addon">数据类型</span> <select
																name="dataType" id="dataType" class="form-control ">
																<option value="">全部</option> 
																${si:ctoption("SyncType", param.dataType) }
															</select>
														</div>
													</div>
													<div class="col-sm-5">
														<div class="input-group ">
															<span class="input-group-addon">操作类型</span> <select
																name="SyncOperType" id="SyncOperType"
																class="form-control search-query">
																<option value="">全部</option>
																${si:ctoption("SyncOperType", param.SyncOperType) }
															</select> <span class="input-group-btn">
																<button type="submit" class="btn btn-purple btn-sm"
																	onclick="return formSubmit();" style="height:32px;">
																	<i class="icon-search icon-on-right bigger-110"></i> 搜索
																</button> 
																<button  class="btn btn-purple btn-sm" onclick="return menuSync()"  id="muenSync"
																   style="left:8px;top:65px;position:absolute;z-index:999;">
																  <i class="icon-refresh bigger-110"></i>同步
																</button>
																</span>
														</div>
													</div>
												</div>
											</form>
										</div>
									</div>
								</div>
								<div class="hr hr12 hr-dotted"></div>
								<ul class="nav nav-tabs" id="myTab">
									<li id="fail"><a href="javascript:void(0);"
										class="navbar-link" onclick="syncInfoList('0');">同步失败</a>
									</li>
									<li id="succ"><a href="javascript:void(0);"
										class="navbar-link" onclick="syncInfoList('1');">同步成功</a>
									</li>
								</ul>
								<div class="table-responsive">
									<table id="sample-table-1"
										class="table table-striped table-bordered table-hover">
										<thead>
											<tr>
												<th class="center">序号</th>
												<th>发送节点</th>
												<th>源节点</th>
												<th>接收节点</th>
												<th>数据类型</th>
												<th>操作类型</th>
												<th>同步时间</th>
												<c:if test="${param.status eq '0' or param.status eq null}">
													<th>异常信息</th>
												</c:if>
											</tr>
										</thead>
										<tbody>
											<c:forEach var="vo" items="${_data}" varStatus="idx">
												<tr>
													<td class="center">${idx.index + 1}</td>
													<td>${vo.fromNodeName}</td>
													<td>${vo.srcNodeName}</td>
													<td>${vo.toNodeName}
													  <c:if test="${vo.fromNode==vo.toNode }">
													    (内网)
													  </c:if>
													</td>
													<td>${si:ctname("SyncType",vo.dataType)}</td>
													<td>${si:ctname("SyncOperType",vo.operType)}</td>
													<td>${si:fmtDate(vo.mtime)}</td>
													<c:if
														test="${param.status eq '0' or param.status eq null }">
														<td><spna class="tipMe" title="${vo.remark}">${si:lmitStrPx(vo.remark,550)}</td>
													</c:if>
												</tr>
											</c:forEach>
										</tbody>
									</table>
									<jsp:include page="/WEB-INF/view/common/pg.jsp">
										<jsp:param value="${ctx}/exch/sync_info_list.do" name="url" />
										<jsp:param value="${_total}" name="total" />
										<jsp:param value="${_urlpara}" name="urlpara" />
									</jsp:include>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		</div>
</body>
</html>
